/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package views;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import javax.swing.JOptionPane;
import java.awt.event.MouseEvent;
import javax.swing.DefaultComboBoxModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
import model.Persona;
import model.Sopaipilla;
import model.bebida;
 

/**
 *
 * @author Sublime
 */
public class ProgramaSopaipillas extends javax.swing.JFrame {
       private int intentos=0;
    /**
     * Creates new form ProgramaSopaipillas
     */
    public ProgramaSopaipillas() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jInternalFrameAcceso = new javax.swing.JInternalFrame();
        jlblUsernameAcceso = new javax.swing.JLabel();
        jlblPasswordAcceso = new javax.swing.JLabel();
        jbtnIngresarAcceso = new javax.swing.JButton();
        jbtnReestablecerAcceso = new javax.swing.JButton();
        jtxtUsernameAcceso = new javax.swing.JTextField();
        jpswPasswordAcceso = new javax.swing.JTextField();
        jInternalFrameRegistrarPersona = new javax.swing.JInternalFrame();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jtxtNombreRegistro = new javax.swing.JTextField();
        jtxtEdadRegistro = new javax.swing.JTextField();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jInternalFrameCompraVenta = new javax.swing.JInternalFrame();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jtxtNombreProcesoCompraVenta = new javax.swing.JTextField();
        jtxtEdadProcesoCompraVenta = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox();
        jInternalFrameBebida = new javax.swing.JInternalFrame();
        jlblNombreBebida = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jtxtNombreBebida = new javax.swing.JTextField();
        jtxtCantidadBebida = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jtxtValorBebida = new javax.swing.JTextField();
        jInternalFrameSopaipilla = new javax.swing.JInternalFrame();
        jLabel7 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jMenuArchivo = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItemLogin = new javax.swing.JMenuItem();
        jMenuItemSalir = new javax.swing.JMenuItem();
        jMenuRegistroPersonas = new javax.swing.JMenu();
        jMenuItemRegistrarPersona = new javax.swing.JMenuItem();
        jMenuItemCompraVenta = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItemAcercaDe = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                formComponentShown(evt);
            }
        });

        jInternalFrameAcceso.setClosable(true);
        jInternalFrameAcceso.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jInternalFrameAcceso.setTitle("Acceso Sistema");
        jInternalFrameAcceso.setVisible(true);

        jlblUsernameAcceso.setText("Username");

        jlblPasswordAcceso.setText("Password");

        jbtnIngresarAcceso.setText("Ingresar");
        jbtnIngresarAcceso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnIngresarAccesoActionPerformed(evt);
            }
        });

        jbtnReestablecerAcceso.setText("Reestablecer");

        javax.swing.GroupLayout jInternalFrameAccesoLayout = new javax.swing.GroupLayout(jInternalFrameAcceso.getContentPane());
        jInternalFrameAcceso.getContentPane().setLayout(jInternalFrameAccesoLayout);
        jInternalFrameAccesoLayout.setHorizontalGroup(
            jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameAccesoLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jInternalFrameAccesoLayout.createSequentialGroup()
                        .addComponent(jbtnIngresarAcceso)
                        .addGap(28, 28, 28)
                        .addComponent(jbtnReestablecerAcceso))
                    .addGroup(jInternalFrameAccesoLayout.createSequentialGroup()
                        .addGroup(jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jlblPasswordAcceso, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jlblUsernameAcceso, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
                        .addGap(26, 26, 26)
                        .addGroup(jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jtxtUsernameAcceso, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
                            .addComponent(jpswPasswordAcceso))))
                .addContainerGap(64, Short.MAX_VALUE))
        );
        jInternalFrameAccesoLayout.setVerticalGroup(
            jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameAccesoLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblUsernameAcceso)
                    .addComponent(jtxtUsernameAcceso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addGroup(jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblPasswordAcceso)
                    .addComponent(jpswPasswordAcceso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
                .addGroup(jInternalFrameAccesoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtnIngresarAcceso)
                    .addComponent(jbtnReestablecerAcceso))
                .addGap(24, 24, 24))
        );

        jInternalFrameRegistrarPersona.setClosable(true);
        jInternalFrameRegistrarPersona.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jInternalFrameRegistrarPersona.setTitle("Registro Personas");
        jInternalFrameRegistrarPersona.setVisible(true);

        jLabel2.setText("Nombre");

        jLabel4.setText("Edad");

        jLabel5.setText("Sexo");

        jtxtNombreRegistro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtNombreRegistroActionPerformed(evt);
            }
        });

        jRadioButton1.setText("Masculino");

        jRadioButton2.setText("Femenino");

        jButton1.setText("Ingresar");

        jButton2.setText("Limpiar");

        javax.swing.GroupLayout jInternalFrameRegistrarPersonaLayout = new javax.swing.GroupLayout(jInternalFrameRegistrarPersona.getContentPane());
        jInternalFrameRegistrarPersona.getContentPane().setLayout(jInternalFrameRegistrarPersonaLayout);
        jInternalFrameRegistrarPersonaLayout.setHorizontalGroup(
            jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(74, 74, 74)
                        .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jRadioButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                            .addGap(15, 15, 15)
                            .addComponent(jButton1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton2))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                            .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                                    .addComponent(jLabel4)
                                    .addGap(74, 74, 74))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addGap(61, 61, 61)))
                            .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jtxtNombreRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jtxtEdadRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(63, Short.MAX_VALUE))
        );
        jInternalFrameRegistrarPersonaLayout.setVerticalGroup(
            jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameRegistrarPersonaLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jtxtNombreRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jtxtEdadRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jRadioButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton2)
                .addGap(139, 139, 139)
                .addGroup(jInternalFrameRegistrarPersonaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2))
                .addContainerGap(320, Short.MAX_VALUE))
        );

        jInternalFrameCompraVenta.setClosable(true);
        jInternalFrameCompraVenta.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jInternalFrameCompraVenta.setTitle("Proceso Compra-Venta");
        jInternalFrameCompraVenta.setVisible(true);

        jPanel1.setForeground(new java.awt.Color(102, 255, 255));

        jLabel1.setText("Nombre");

        jLabel3.setText("Tipo");

        jLabel6.setText("Edad");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6))
                .addGap(46, 46, 46)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jtxtEdadProcesoCompraVenta)
                    .addComponent(jtxtNombreProcesoCompraVenta)
                    .addComponent(jComboBox1, 0, 98, Short.MAX_VALUE))
                .addGap(0, 104, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(jtxtNombreProcesoCompraVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jtxtEdadProcesoCompraVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(57, 57, 57))
        );

        javax.swing.GroupLayout jInternalFrameCompraVentaLayout = new javax.swing.GroupLayout(jInternalFrameCompraVenta.getContentPane());
        jInternalFrameCompraVenta.getContentPane().setLayout(jInternalFrameCompraVentaLayout);
        jInternalFrameCompraVentaLayout.setHorizontalGroup(
            jInternalFrameCompraVentaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameCompraVentaLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(74, Short.MAX_VALUE))
        );
        jInternalFrameCompraVentaLayout.setVerticalGroup(
            jInternalFrameCompraVentaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameCompraVentaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jInternalFrameBebida.setTitle("Bebida");
        jInternalFrameBebida.setVisible(true);

        jlblNombreBebida.setText("Nombre Bebida");

        jLabel8.setText("Cantidad");

        jtxtCantidadBebida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtCantidadBebidaActionPerformed(evt);
            }
        });

        jLabel9.setText("Valor");

        jtxtValorBebida.setForeground(new java.awt.Color(255, 0, 51));

        javax.swing.GroupLayout jInternalFrameBebidaLayout = new javax.swing.GroupLayout(jInternalFrameBebida.getContentPane());
        jInternalFrameBebida.getContentPane().setLayout(jInternalFrameBebidaLayout);
        jInternalFrameBebidaLayout.setHorizontalGroup(
            jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameBebidaLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrameBebidaLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(68, 68, 68)
                        .addGroup(jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jInternalFrameBebidaLayout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addGap(43, 43, 43)
                                .addComponent(jtxtValorBebida, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jtxtCantidadBebida, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jInternalFrameBebidaLayout.createSequentialGroup()
                        .addComponent(jlblNombreBebida)
                        .addGap(39, 39, 39)
                        .addComponent(jtxtNombreBebida, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jInternalFrameBebidaLayout.setVerticalGroup(
            jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameBebidaLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblNombreBebida)
                    .addComponent(jtxtNombreBebida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addGroup(jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jtxtCantidadBebida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addGroup(jInternalFrameBebidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jtxtValorBebida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27))
        );

        jInternalFrameSopaipilla.setTitle("Sopaipilla");
        jInternalFrameSopaipilla.setVisible(true);

        jLabel7.setText("Cantidad");

        jLabel10.setText("Valor");

        jTextField1.setText("jTextField1");

        javax.swing.GroupLayout jInternalFrameSopaipillaLayout = new javax.swing.GroupLayout(jInternalFrameSopaipilla.getContentPane());
        jInternalFrameSopaipilla.getContentPane().setLayout(jInternalFrameSopaipillaLayout);
        jInternalFrameSopaipillaLayout.setHorizontalGroup(
            jInternalFrameSopaipillaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameSopaipillaLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(jLabel7)
                .addGap(33, 33, 33)
                .addGroup(jInternalFrameSopaipillaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jInternalFrameSopaipillaLayout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addGap(28, 28, 28)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jInternalFrameSopaipillaLayout.setVerticalGroup(
            jInternalFrameSopaipillaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameSopaipillaLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(jInternalFrameSopaipillaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
                .addGroup(jInternalFrameSopaipillaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27))
        );

        javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout(jDesktopPane1);
        jDesktopPane1.setLayout(jDesktopPane1Layout);
        jDesktopPane1Layout.setHorizontalGroup(
            jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDesktopPane1Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jInternalFrameAcceso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(91, 91, 91)
                .addComponent(jInternalFrameRegistrarPersona, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
                .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jInternalFrameCompraVenta)
                    .addComponent(jInternalFrameBebida)
                    .addComponent(jInternalFrameSopaipilla, javax.swing.GroupLayout.Alignment.LEADING))
                .addGap(20, 20, 20))
        );
        jDesktopPane1Layout.setVerticalGroup(
            jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDesktopPane1Layout.createSequentialGroup()
                .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jDesktopPane1Layout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jInternalFrameRegistrarPersona, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jDesktopPane1Layout.createSequentialGroup()
                                .addComponent(jInternalFrameCompraVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jInternalFrameBebida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(43, 43, 43)
                                .addComponent(jInternalFrameSopaipilla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jDesktopPane1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jInternalFrameAcceso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jDesktopPane1.setLayer(jInternalFrameAcceso, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setLayer(jInternalFrameRegistrarPersona, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setLayer(jInternalFrameCompraVenta, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setLayer(jInternalFrameBebida, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jDesktopPane1.setLayer(jInternalFrameSopaipilla, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jMenu1.setText("Archivo");

        jMenuItemLogin.setText("Loggin");
        jMenuItemLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemLoginActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemLogin);

        jMenuItemSalir.setText("Salir");
        jMenuItemSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSalirActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItemSalir);

        jMenuArchivo.add(jMenu1);

        jMenuRegistroPersonas.setText("Opciones");

        jMenuItemRegistrarPersona.setText("Registro Personas");
        jMenuItemRegistrarPersona.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRegistrarPersonaActionPerformed(evt);
            }
        });
        jMenuRegistroPersonas.add(jMenuItemRegistrarPersona);

        jMenuItemCompraVenta.setText("Compra - Venta");
        jMenuItemCompraVenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCompraVentaActionPerformed(evt);
            }
        });
        jMenuRegistroPersonas.add(jMenuItemCompraVenta);

        jMenuArchivo.add(jMenuRegistroPersonas);

        jMenu3.setText("Ayuda");

        jMenuItemAcercaDe.setText("Acerca de...");
        jMenu3.add(jMenuItemAcercaDe);

        jMenuArchivo.add(jMenu3);

        jMenu4.setText("jMenu4");

        jMenuItem1.setText("jMenuItem1");
        jMenu4.add(jMenuItem1);

        jMenuArchivo.add(jMenu4);

        setJMenuBar(jMenuArchivo);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jDesktopPane1)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

   
    
    
    private void jtxtNombreRegistroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtNombreRegistroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtxtNombreRegistroActionPerformed

    private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
        this.jInternalFrameRegistrarPersona.setVisible(true);
        this.jInternalFrameCompraVenta.setVisible(true);
        this.jMenuItemRegistrarPersona.setEnabled(true);
        this.jMenuItemCompraVenta.setEnabled(true);
        this.jMenuItemAcercaDe.setEnabled(true);
        this.jInternalFrameAcceso.setVisible(true);
        
    }//GEN-LAST:event_formComponentShown

    private void jbtnIngresarAccesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnIngresarAccesoActionPerformed
       /*String user = this.jtxtUsernameAcceso.getText();
       String pass = String.valueOf(this.jpswPasswordAcceso.getpassword());
        this.validarAccesoSistema(user, pass);
        
        */
    }//GEN-LAST:event_jbtnIngresarAccesoActionPerformed

    private void jMenuItemSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSalirActionPerformed
        this.dispose();
    }//GEN-LAST:event_jMenuItemSalirActionPerformed

    private void jMenuItemLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLoginActionPerformed
        this.jInternalFrameAcceso.setVisible(true);
        
    }//GEN-LAST:event_jMenuItemLoginActionPerformed

    private void jtxtCantidadBebidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtCantidadBebidaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtxtCantidadBebidaActionPerformed

    private void jMenuItemCompraVentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCompraVentaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItemCompraVentaActionPerformed

    private void jMenuItemRegistrarPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRegistrarPersonaActionPerformed
        
    }//GEN-LAST:event_jMenuItemRegistrarPersonaActionPerformed

    
    private void limpiarFormularioAcceso(){
        this.jtxtUsernameAcceso.requestFocus();
        this.jtxtUsernameAcceso.setText(null);
        this.jpswPasswordAcceso.setText(null);
        
    }
    
    
    
    
    private void validarAccesoSistema(String user,String pass){
        String username = "admin";
        String password = "123";
        if(username.equals(user) && password.equals(pass))
        {
            this.jMenuItemRegistrarPersona.setEnabled(true);
            this.jMenuItemCompraVenta.setEnabled(true);
            this.jMenuItemAcercaDe.setEnabled(true);
            this.jInternalFrameAcceso.setVisible(false);
        }
        else
        {
            intentos++;
            limpiarFormularioAcceso();
            if (intentos == 3)
            {
                JOptionPane.showMessageDialog(null, "Haz alcanado el numero maximo de intentos.\nLa aplicacion se cerrara...\nChao CTM!!!","Ventana", JOptionPane.ERROR_MESSAGE);
                this.dispose();
            }
            else
            {
                JOptionPane.showMessageDialog(null, "Username o password invalidos", "Error de Acceso",JOptionPane.ERROR_MESSAGE);
            }
        }
    }
            
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ProgramaSopaipillas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ProgramaSopaipillas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ProgramaSopaipillas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ProgramaSopaipillas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ProgramaSopaipillas().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JInternalFrame jInternalFrameAcceso;
    private javax.swing.JInternalFrame jInternalFrameBebida;
    private javax.swing.JInternalFrame jInternalFrameCompraVenta;
    private javax.swing.JInternalFrame jInternalFrameRegistrarPersona;
    private javax.swing.JInternalFrame jInternalFrameSopaipilla;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuArchivo;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItemAcercaDe;
    private javax.swing.JMenuItem jMenuItemCompraVenta;
    private javax.swing.JMenuItem jMenuItemLogin;
    private javax.swing.JMenuItem jMenuItemRegistrarPersona;
    private javax.swing.JMenuItem jMenuItemSalir;
    private javax.swing.JMenu jMenuRegistroPersonas;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JButton jbtnIngresarAcceso;
    private javax.swing.JButton jbtnReestablecerAcceso;
    private javax.swing.JLabel jlblNombreBebida;
    private javax.swing.JLabel jlblPasswordAcceso;
    private javax.swing.JLabel jlblUsernameAcceso;
    private javax.swing.JTextField jpswPasswordAcceso;
    private javax.swing.JTextField jtxtCantidadBebida;
    private javax.swing.JTextField jtxtEdadProcesoCompraVenta;
    private javax.swing.JTextField jtxtEdadRegistro;
    private javax.swing.JTextField jtxtNombreBebida;
    private javax.swing.JTextField jtxtNombreProcesoCompraVenta;
    private javax.swing.JTextField jtxtNombreRegistro;
    private javax.swing.JTextField jtxtUsernameAcceso;
    private javax.swing.JTextField jtxtValorBebida;
    // End of variables declaration//GEN-END:variables
}
